<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div style="padding-top: 20px">
    <input type="hidden" id="exam_hidden_id" th:value="${exam.id}"/>
    <input type="hidden" id="exam_hidden_name" th:value="${exam.name}"/>
    <div class="alert alert-info" role="alert" >
        [[${exam.name}]] <th:block th:if="${exam.status=='未发布'}"><span style="float: right;"><a th:onclick="exam.editName([[${exam.id}]])" href="javascript:void(0)" style="margin-right: 10px">|编辑</a></span></th:block><span style="float: right;right: 0"><a onclick="exam.return()" href="javascript:void(0)" style="margin-left: 10px">返回</a></span>
    </div>
    <th:block th:if="${exam.status=='未发布'}">
        <div style="position: relative;left:250px;width:70%;background: #cccccc;height: 50px;padding-top: 10px;padding-bottom: 5px;padding-right: 20px" id="exam_edit_head">
            <button onclick="exam.editSave()" style="float: right;" class="btn btn-info">保存</button>
        </div>
    </th:block>
    <div style="padding-left:20px;margin-top: 20px;background: #cccccc;position: relative;left: 250px;width: 70%;height: 700px" id="exam_edit_content">
        <div id="exam_edit_relation_template" style="padding-top: 20px">
            <form class="form-inline">
                <div class="form-group">
                    <label for="exam_relation_input">关联模板:</label>
                    <input th:value="${exam.template_id!=null?exam.template_id:''}" type="hidden" id="exam_relation_input_hidden"/>
                    <input th:value="${exam.course!=null?exam.course:''}" type="hidden" id="exam_relation_input_hidden_name"/>
                    <input th:readonly="${exam.status=='未发布'?'false':'true'}" th:value="${exam.yuliu1!=null?exam.yuliu1:''}" id="exam_relation_input" class="form-control" />
                    <th:block th:if="${exam.status=='未发布'}">
                        <a onclick="exam.relationTemplate()" href="javascript:void(0)" style="margin-left: 10px">关联模板</a>
                    </th:block>

                    <a onclick="exam.relationTemplateInfo()" href="javascript:void(0)" style="margin-left: 10px">模板详情</a>
                </div>

            </form>
        </div>
        <div id="exam_edit_around_time" style="margin-top: 20px">
            <div class="form-group">
                <label for="exam_edit_around">填写考试区间：<input th:disabled="${exam.status=='未发布'?'false':'true'}" th:checked="${exam.start_time!=null && exam.end_time!=null?true:false}" onclick="exam.selectTimeResolve('区间')"  id="exam_edit_around" name="select_time" type="radio"/></label><th:block th:if="${exam.status=='未发布'}"><a style="margin-left: 180px" onclick="exam.cancelTimeBind()" href="javascript:void(0)">取消时间选定</a></th:block>
            </div>
            <div style="padding-left: 20px">
                <div class="form-group">
                    <span for="exam_edit_start_time">开始时间：<input th:disabled="${exam.status=='未发布'?'false':'true'}" th:value="${#dates.format(exam.start_time,'yyyy-MM-dd HH:mm')}" id="exam_edit_start_time" type="datetime-local"></span>
                </div>
                <div class="form-group">
                    <span for="exam_edit_end_time">结束时间：<input th:disabled="${exam.status=='未发布'?'false':'true'}" th:value="${#dates.format(exam.end_time,'yyyy-MM-dd HH:mm')}" id="exam_edit_end_time" type="datetime-local"></span>
                </div>
            </div>
        </div>
        <div id="exam_edit_defined_time" style="margin-top: 20px">
            <div class="form-group">
                <label for="exam_edit_duration_time">填写考试时长：<input th:disabled="${exam.status=='未发布'?'false':'true'}" th:checked="${exam.duration!=null?true:false}" onclick="exam.selectTimeResolve('时长')" id="exam_edit_duration_time" name="select_time" type="radio"/></label>
            </div>
            <div style="padding-left: 20px">
                <div class="form-group">
                    <span for="exam_edit_duration">考试时长：<select th:disabled="${exam.status=='未发布'?'false':'true'}" th:value="${exam.duration}" id="exam_edit_duration">
                        <th:block th:if="${exam==null}">
                            <option>30分钟</option>
                            <option>60分钟</option>
                            <option>120分钟</option>
                            <option>180分钟</option>
                        </th:block>
                        <th:block th:unless="${exam==null}">
                            <th:block th:if="${exam.duration!=null}">
                                <option th:text="${exam.duration+'分钟'}"></option>
                                <option th:if="${exam.duration!=30}">30分钟</option>
                                <option th:if="${exam.duration!=60}">60分钟</option>
                                <option th:if="${exam.duration!=120}">120分钟</option>
                                <option th:if="${exam.duration!=180}">180分钟</option>
                            </th:block>
                            <th:block th:if="${exam.duration==null}">
                                <option>30分钟</option>
                                <option>60分钟</option>
                                <option>120分钟</option>
                                <option>180分钟</option>
                            </th:block>

                        </th:block>
                    </select></span>
                </div>
            </div>
        </div>
        <div id="exam_edit_class" style="margin-top: 20px">
            <th:block th:if="${exam.status=='未发布'}">
                <div>
                    <button onclick="exam.selectClass()" class="btn btn-default">选择班级</button>
                    <button onclick="exam.definedClass()" class="btn btn-default" style="margin-left: 10px">自定义班级</button>
                    <button onclick="exam.importClass()" class="btn btn-default" style="margin-left: 10px">导入班级</button>
                </div>
            </th:block>
        </div>
        <div id="exam_edit_table" style="margin-top: 20px">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <td style="width: 5%"><input type="checkbox"/></td>
                        <td style="width: 5%">序号</td>
                        <td style="width: 30%">班级名称</td>
                        <td style="width: 15%">班级人数</td>
                        <td style="width: 15%">选择人数</td>
                        <td style="width: 30%">操作</td>
                    </tr>
                </thead>
                <tbody>
                    <th:block th:if="${bindStudentClasses==null}">
                        <tr><td colspan="6" align="center">没有任何查询记录</td></tr>
                    </th:block>
                    <th:block th:unless="${bindStudentClasses==null}">
                        <tr th:each="studentClassInfo:${bindStudentClasses}">
                            <td><input type="checkbox"/></td>
                            <td th:text="${studentClassInfoStat.index+1}"></td>
                            <td th:text="${studentClassInfo.className}"></td>
                            <td th:text="${studentClassInfo.classStudentTotal}"></td>
                            <td th:text="${studentClassInfo.selectStudentNumber}"></td>
                            <td>
                                <th:block th:if="${exam.status=='未发布'}">
                                    <button th:onclick="exam.removeClass([[${studentClassInfo.className}]])" class="btn btn-default">移除班级</button>
                                    <button th:onclick="exam.adjustStudent([[${studentClassInfo.className}]])" class="btn btn-default">调整学生</button>
                                    <th:block th:if="${studentClassInfo.status!=null and studentClassInfo.status=='自定义'}">
                                        <button th:onclick="exam.importClassStudent([[${studentClassInfo.className}]])" class="btn btn-default">导入学生</button>
                                    </th:block>
                                </th:block>
                                <th:block th:unless="${exam.status=='未发布'}">
                                    <button th:onclick="exam.studentInfo([[${studentClassInfo.className}]])" class="btn btn-default">班级详情</button>
                                </th:block>

                            </td>
                        </tr>
                    </th:block>
                </tbody>
            </table>
        </div>
    </div>

</div>
</html>